﻿//
// Created by QU on 24-9-28.
//
#ifndef SIMPLE_CLIENT_H
#define SIMPLE_CLIENT_H

#include <boost/asio.hpp>
#include <random>
#include <vector>

using boost::asio::ip::tcp;

class SimpleClient
{
public:
    SimpleClient(boost::asio::io_context& io_context, const std::string& host, const std::string& port,
                 uint16_t min_payload_size, uint16_t max_payload_size);

    void send_random_data();
    void receive_data();
    static std::ostream& printBuffer(std::ostream& os, const std::vector<std::byte>& buffer, size_t buffer_size,
                                     size_t header_size = 0);

private:
    tcp::socket socket_;
    uint16_t min_payload_size_;
    uint16_t max_payload_size_;
    std::mt19937 random_engine_;
};

#endif // SIMPLE_CLIENT_H
